﻿#region Information
/*
 * Author: Zng Tfy
 * Email: nvt87x@gmail.com
 * Phone: +84 1645 515 010
 * ---------------------------
 * Create: 29/05/2013 11:13
 * Update: 17/06/2013 14:23
 * Status: OK
 */
#endregion

using System;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections.Generic;

namespace WS.DAL
{
    public abstract class DanhmucDAL : BaseDAL, IBase
    {
        #region Implement
        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(object obj = null, int skip = 0, int take = 0)
        {
            return Mapper.QueryForDataTable("GetAllDanhmuc", null);
        }

        public object Insert(object obj)
        {
            return _sqlMapper.Insert("InsertDanhmuc", obj);
        }

        public object Update(object obj)
        {
            return _sqlMapper.Update("UpdateDanhmuc", obj);
        }

        public object Update(DataTable tbl)
        {
            foreach (var r in tbl.Rows)
            {

            }

            return true;
        }

        public object Delete(Guid id = new Guid())
        {
            return _sqlMapper.Delete("DeleteDanhmuc", id);
        }
        #endregion

        public DataTable SelectLoai(string loai)
        {
            return Mapper.QueryForDataTable("GetLoaiDanhmuc", loai);
        }

        public DataTable SelectLoai_Child(Guid Id_Parent)
        {
            return Mapper.QueryForDataTable("GetLoai_Child", Id_Parent);
        }
    }
}